<!DOCTYPE html>
<html>
<head>
#include("/admin/_common/head.html")
<title>权限列表</title>
</head>
<body class="pear-container">
    <div class="layui-panel query-panel /*查询面板*/">
        <form class="layui-form layui-row layui-col-space16" lay-filter="query-form" onsubmit="return false;">
        	<div class="layui-col-xl2 layui-col-lg2 layui-col-md2 layui-col-sm3 layui-col-xs6">
				<div class="layui-input-wrap">
					<div class="layui-input-prefix">
						<i class="pear-icon pear-icon-text"></i>
					</div>
					<input type="text" name="word" value="#(word??)" placeholder="模糊查询" autocomplete="off" class="layui-input" lay-affix="clear">
				</div>
		    </div>
        	<div class="layui-col-xl2 layui-col-lg2 layui-col-md2 layui-col-sm3 layui-col-xs6">
				<div class="layui-input-wrap">
                    <select name="type">
                        <option value="">-- 类型 --</option>
                     #DICTS("permission_type")
                     #for(item : dicts)
                        <option value="#(item.value)"#if(type?? == item.value) selected#end>#(item.label)</option>
                     #end
                    </select>
                </div>
            </div>
            <div class="layui-col-xl2 layui-col-lg2 layui-col-md2 layui-col-sm3 layui-col-xs6">
                <div class="layui-btn-group">
                    <button type="button" class="layui-btn layui-btn-sm query-form-search">
                        <i class="layui-icon layui-icon-search"></i> 搜索
                    </button>
                    <button type="button" class="layui-btn layui-btn-sm layui-btn-primary query-form-reset">
                        <i class="layui-icon layui-icon-refresh"></i> 重置
                    </button>
                </div>
            </div>
        </form>
    </div>
                    
    <div class="layui-panel data-panel /*数据面板*/">
        <table id="data-table" lay-filter="data-table"></table>
    </div>

    <!-- 图标字段 -->
    <script type="text/html" id="bean-icon">
        <i class="layui-icon {{d.icon}}"></i>
    </script>
    
    <!-- 类型字段 -->
    <script type="text/html" id="bean-typeName">
    <!-- #DICTS(parentKey="permission_type")#for(item : dicts) -->
    #[[{{# if(d.type == ']]##(item.value)#[[') { }}]]#
        <span class="#(item.listClass)">#(item.label)</span>
    #[[{{# } }}]]#
    <!-- #end -->
    </script>

#set(tableButtonsHtml = '')
#set(recordButtonsHtml = '')
#include("../../_common/data_table_template.html"
    , customTableButtons = tableButtonsHtml
    , customRecordButtons = recordButtonsHtml
)

#include("../../_common/foot.html")

<script type="text/javascript">
/*
 * 定义权限开关
 */
var RIGHTS = { NONAME: null // 无用，占个位
//#authPermissions('system:permission:add')
    ,add: true
    ,addChild: true
//#end
//#authPermissions('system:permission:edit')
    ,edit: true
//#end
//#authPermissions('system:permission:del')
    ,remove: true
//#end
//#authPermissions('system:permission:query')
    ,detail: true
//#end
    ,expandAll: true
    ,foldAll: true
};

/*
 * 模块操作路径
 */
var MODULE_PATH = "#CTX()/admin/system/permission/";

/*
 * 默认弹窗大小
 */
var POPUP_AREA = ['720px', '95%'];

/*
 * 数据表的OPTIONS
 */
var OPTIONS = {
    initSort: {"field": "sort", "type": "asc"},
    cols: [[
        {type: 'radio', align: 'center', width: 60},
        {align: 'center', width: 80, title: '状态', templet: '#bean-status'},
        //{field: 'id', align: 'center', width: 80, title: 'ID'},
        //{field: 'ancestors', align: 'left', width: 80, title: '祖先ID'},
        {field: 'icon', align: 'center', width: 80, title: '图标', templet: '#bean-icon'},
        {field: 'name', align: 'left', minWidth: 150, width: '20%', title: '名称'},
        {align: 'center', width: 80, title: '类型', templet: '#bean-typeName'},
        {field: 'sort', align: 'center', width: 80, title: '排序'},
        {field: 'value', align: 'left', minWidth: 250, width: '30%', title: '权限值'},
        {toolbar: '#record-toolbar', align: 'left', minWidth: 240}
    ]]
};
/*
 * 数据表格类型
 */
var TABLE_TYPE = "TREE";
</script>

<script src="#CTX()/admin/js/query_form.js?_v=#VERSION()"></script>
<script src="#CTX()/admin/js/data_table.js?_v=#VERSION()"></script>

<script type="text/javascript">
/*
 * Layui相关脚本
 */
layui.use(['jquery', 'common'], () => {
    var $ = layui.jquery, common = layui.common; // 数据表格
    
    /*
     * 页面加载完成时加载表格数据
     */
    $(document).ready(() => {
        window.treeTable.search();
    });
    
});
</script>

</body>
</html>
